package com.ossean.dao2;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.ossean.model.GithubProject;
import com.ossean.model.OpenhubProject;
import com.ossean.model.OschinaProject;
import com.ossean.model.SourceForgeProject;


public interface PlatformProjectDao {

	@Select("select name,rate_num,user_num from ${table} where url = #{url} group by url_md5 order by extracted_time desc")
	public OpenhubProject getOpenHubPrjByUrl( @Param("table") String table,@Param("url") String url);
	
	@Select("select name,download_num,favor_num from ${table} where url = #{url} group by url_md5 order by extracted_time desc")
	public SourceForgeProject getSourceForgePrjByUrl(@Param("table") String table, @Param("url") String url);//oschina_project
	
	@Select("select name,star_num,user_num from ${table} where url = #{url} group by url_md5 order by extracted_time desc")
	public OschinaProject getOschinaPrjByUrl(@Param("table") String table,@Param("url") String url);
	
	@Select("select id,short_name,name,stargazers_count,forks from ${table} where url = #{url} group by url_md5 order by extracted_time desc")
	public GithubProject getGithubPrjByUrl(@Param("table") String table,@Param("url") String url);
    //获取创建时间以比较项目的可信度
	@Select("select created_time from ${table} where url_md5=#{url_md5}")
	public List<String> getTime(@Param("table") String table, @Param("created_time") String created_time,@Param("url_md5") String url_md5);
	//获取star_num,download_num等判断各项目热度
	@Select("select ${star_num} from ${table} where url_md5=#{url_md5}")
	public List<Integer> getHotValue(@Param("table") String table, @Param("star_num") String star_num,@Param("url_md5") String url_md5);
}
